/*
 * @Description: 判断数据类型
 * @Author: chenjiaxin
 * @Date: 2022-02-02 12:22:52
 * @LastEditTime: 2022-02-04 16:23:00
 * @FilePath: \super-unit\lib\type-tool\index.js
 */
let optoString = Object.prototype.toString;

/**
 * 判断是否 是Date类型数据
 * @param {object} val
 * @returns {Boolean}
 */
const isDate = (val) => {
  return optoString.call(val) === "[object Date]";
};

/**
 *
 * @param {*} value
 * @returns
 */
const createIterableValue = (value) => {
  let n;
  switch (value) {
    case "Array":
      n = [];
      break;
    case "Set":
      n = new Set();
      break;
    case "Map":
      n = new Map();
      break;
    case "WeakSet":
      n = new WeakSet();
      break;
    case "WeakMap":
      n = new WeakMap();
      break;
    default:
      break;
  }
  return n;
};

module.exports = {
  isDate,
  optoString,
  createIterableValue
};
// export default {
//   isDate
// }
